package cn.jcby.app.lebu.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import cn.jcby.app.lebu.utils.PageUtils;

import cn.jcby.app.lebu.dao.UserEnergyDao;
import cn.jcby.app.lebu.entity.UserEnergyEntity;
import cn.jcby.app.lebu.service.UserEnergyService;
import cn.jcby.app.lebu.controller.req.BasicListReq ;

@Service("userEnergyService")
public class UserEnergyServiceImpl extends ServiceImpl<UserEnergyDao, UserEnergyEntity> implements UserEnergyService {

    @Override
    public PageUtils queryPage(BasicListReq params) {
        IPage<UserEnergyEntity> page = this.page(
                new Page<>(params.getPage(),params.getLimit()),
                Wrappers.<UserEnergyEntity>lambdaQuery()
        );

        return new PageUtils(page);
    }
    @Override
    public void add(UserEnergyEntity userEnergyReq){
        UserEnergyEntity userEnergy = new UserEnergyEntity() ;
        save(userEnergy) ;
    }

    @Override
    public void updateBy(UserEnergyEntity userEnergyReq){
        UserEnergyEntity userEnergy = new UserEnergyEntity() ;
        updateById(userEnergy) ;
    }
}